<?php

namespace Home\Controller;

use Think\Controller;

/**
 * 基础控制器
 * @author yukari
 * 2018-06-26
 */
class BaseController extends Controller
{

    /**
     * 基类构造函数，初始化公共模板页面
     * @author yukari
     * 2018-06-26
     */
    public function _initialize(){

        //TODO请在此进行初始化、用户权限验证等；

    }

    /**
     * Api接口统一输出,0表示执行成功
     * @author yukari
     * 2018-08-26
     */
    public function response($data = array(),$code = 0,$msg = "success")
    {

        $response = array('code' => $code, 'data' => $data,'errmsg' => $msg);

        $this->ajaxReturn($response);
    }

}
